<?php
class NavigateModel extends MongoModel {
	var $table = 'navigate';
	var $name = '导航栏';
	

	/**
	 * 为表单而添加的方法，在CateAttr中引用
	 * @param unknown_type $site_id
	 * @param unknown_type $columns
	 * @param unknown_type $lang
	 */
	public function get_cates($site_id, $columns=null, $lang=null){
		$id = $_REQUEST['id'];
		$columns = 'items';
		$navigate = self::get_by_attrs(array('site_id'=>$site_id, '_id'=>$id), 'items');
		$options = array();
		if(empty($navigate) || !isset($navigate['items']))return $options;
		if(isset($_REQUEST['lang'])){
			//多语言
			$lang = $_REQUEST['lang'];
			if(!isset($navigate['items'][$lang]))return $options;
			foreach($navigate['items'][$lang] as $nav_id=>$nav){
				$options[$nav_id] = $nav;
			}
		}else{
			foreach($navigate['items'] as $nav_id=>$nav){
				$options[$nav_id] = $nav;
			}
		}
		return $options;
	}
}

?>